class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        sort(price.begin(),price.end());
        int left=0;int right=price.size()-1;
        while(left<right)
        {
            if(price[left]+price[right]>target)
            {
                right--;
            }    
            else if(price[left]+price[right]<target)
            {
                left++;
            }
            else 
            {
                vector<int> s{price[left],price[right]};
                return s;
            }
        
        }
        vector<int> s1{1,1};
        return s1;
    }
};